class Solution
{
public:
    vector<int> xorQueries(vector<int> &arr, vector<vector<int>> &queries)
    {
        int n = arr.size();
        vector<int> xorPrefix(n + 1);
        xorPrefix[0] = 0;
        for (int i = 0; i < n; ++i)
        {
            xorPrefix[i + 1] = xorPrefix[i] ^ arr[i];
        }
        vector<int> result;
        for (auto &q : queries)
        {
            result.push_back(xorPrefix[q[0]] ^ xorPrefix[q[1] + 1]);
        }
        return result;
    }
};